from pymongo import MongoClient
client=MongoClient("127.0.0.1:27017")
db = client.get_database("test")
db.avengers.insert_many(
   [
     {"name": "Robert Downey Jr.", "role": "Tony Stark / Iron Man" },
     {"name": "Chris Evans", "role": "Steve Rogers / Captain America" },
     {"name": "Mark Ruffalo", "role": "Bruce Banner / The Hulk" },
     {"name": "Chris Hemsworth", "role": "Thor" },
     {"name": "Scarlett Johansson", "role": "Natasha Romanoff / Black Widow " }
   ]
)
db.avengers.create_index([("name","text"), ("role","text")])
result = db.avengers.find({"$text":{"$search":"Chris"}})
for i in result:
    print(i)
db.client.close()